//
//  YZBytesTool.h
//  RoamanIOS
//
//  Created by apple on 31/5/2018.
//  Copyright © 2018年 roaman. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface YZBytesTool : NSObject

+ (NSData *)dataFromUint32:(uint32_t)num;
+ (NSData *)dataFromUint16:(uint16_t)num;
+ (NSData *)dataFromUint8:(uint8_t)num;

+ (uint32_t)uint32FromBytes:(Byte [])bytes;
+ (uint16_t)uint16FromBytes:(Byte [])bytes;
+ (uint8_t)uint8FromBytes:(Byte [])bytes;







+ (int)intType:(Byte)value ;
+ (int)bytesToInt2:(Byte [])src;
+ (int)intLength:(Byte [])value;
+ (int)lBytesToInt:(Byte *)byte;
+ (NSData *)hexToBytes:(NSString *)str;
- (NSData *)setId:(int)Id ;
- (NSData *)set2Id:(int)Id ;
+ (long)bytes2long:(Byte *)byteNum;
+ (NSString *)mac2String:(Byte *)byte;
+ (NSString *)convertToJsonData:(NSDictionary *)dict;
+ (NSString *)hexStringFromData:(NSData *)data;
- (NSString *)toBinarySystemWithDecimalSystem:(int)num length:(int)length;
- (NSString *)toDecimalWithBinary:(NSString *)binary;
- (NSString *)getBinaryByhex:(NSString *)hex binary:(NSString *)binary;
- (unsigned)parseIntFromData:(NSData *)data;

+ (BOOL) validPhone:(NSString *)phone;
+ (BOOL) isValidateEmail:(NSString *)email;
+ (BOOL) isEmptyString:(NSString *)string;
+ (BOOL) isEmptyArray:(NSArray *)array;
// 读取字节
+ (Boolean)readFlagsBit:(Byte)byte andIndex:(NSInteger)index;



/**
 求一个数组中的最大值

 @param array <#array description#>
 @return <#return value description#>
 */
+ (int)getMax:(NSArray *)array;

/**
 求一个数组中的最小值

 @param array <#array description#>
 @return <#return value description#>
 */
+ (int)getMin:(NSArray *)array;

/**
 求一个数组中的最小值

 @param array <#array description#>
 @return <#return value description#>
 */
+ (int)getAverage:(NSArray *)array;




+ (float)getFloatMax:(NSArray *)array;

+ (float)getFloatMin:(NSArray *)array;

+ (float)getFloatAverage:(NSArray *)array;
@end
